package com.asurplus.weixin.controller;


import com.asurplus.common.layui.LayuiTableResult;
import com.asurplus.system.service.SysDictDetailService;
import com.asurplus.weixin.entity.WeixinSubscribeLog;
import com.asurplus.weixin.service.WeixinSubscribeLogService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 微信关注/取消关注日志表 前端控制器
 * </p>
 *
 * @author lizhou
 * @since 2020-11-06
 */
@Controller
@RequestMapping("/wechat/weixin-subscribe-log")
public class WeixinSubscribeLogController {

    @Autowired
    private WeixinSubscribeLogService weixinSubscribeLogService;
    @Autowired
    private SysDictDetailService sysDictDetailService;

    @ApiOperation(value = "请求微信关注日志列表页")
    @GetMapping("init")
    public String init(Model model) {
        model.addAttribute("type", sysDictDetailService.listSysDictDetailByDictCode("weixin_subscribe_type"));
        return "weixin/subscribelog/list";
    }

    @ApiOperation(value = "分页查询微信关注列表数据")
    @PostMapping("list")
    @ResponseBody
    public LayuiTableResult list(Integer page, Integer limit, WeixinSubscribeLog weixinSubscribeLog) {
        return weixinSubscribeLogService.list(page, limit, weixinSubscribeLog);
    }
}
